package com.nolydake.swingnote.gui.renderer;

import java.awt.Color;
import java.awt.Component;
import java.io.Serializable;

import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;

public class DataListCellRenderer implements ListCellRenderer<Object>, Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -2407674386955001561L;

    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
            boolean cellHasFocus) {

        JPanel panel = (JPanel) value;

        if (isSelected) {
            panel.setBackground(Color.LIGHT_GRAY);
        } else {
            panel.setBackground(Color.WHITE);
        }

        return panel;
    }
}
